# download sftp if not exist
if [ ! -f "sftp" ]; then
    wget https://gitee.com/anolis/hygon-devkit/raw/master/tools/sftp
    chmod +x sftp
fi

# download and update dtk
echo "downloading dtk"
./sftp download hygon-devkit/4.0/2025-01-01/csv/dcu/libamd_comgr.so libamd_comgr.so
./sftp download hygon-devkit/4.0/2025-01-01/csv/dcu/libgalaxyhip.so libgalaxyhip.so
./sftp download hygon-devkit/4.0/2025-01-01/csv/dcu/opencl.bc opencl.bc
echo "updating dtk"
cp libamd_comgr.so /opt/dtk/lib/libamd_comgr.so.2.4.24.04.1
cp libgalaxyhip.so /opt/dtk/hip/lib/libgalaxyhip.so.5.2.24225.868-f087114b
cp opencl.bc /opt/dtk/amdgcn/bitcode/opencl.bc

